package com.demo.sortcsv;

import com.demo.sortcsv.domain.CanDetailDongFeng;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.util.Collections;
import java.util.List;
@Slf4j
public class SortCsv {

    public static void main(String[] args) throws IOException {

        String [] heads = {"上传时间","采集时间","转速(r/min)","发动机瞬时油耗(L/h)","总油耗(L)","刹车","车速fef1km/h",
                "车速fe6ckm/h","总里程fec1km","总里程fee0km","油门开度%","冷却液温度℃","燃油压力Bar","进气歧管绝对压力Bar",
                "进气口温度℃","空气流量mg/strk","节气门位置","发动机运行时间s","冲程油量mg","扭矩百分比%"};
        List<CanDetailDongFeng> canDetailDongFengs = CsvUtils.readCsv("/Users/jasper/Downloads/107015090152992.csv");

        ComparatorByFuelPressure comparatorByFuelPressure = new ComparatorByFuelPressure(true);

        Collections.sort(canDetailDongFengs, comparatorByFuelPressure);
        String fileName = "107015090152992.csv";
        String outPath = "/Users/jasper/data/"+fileName;


        CsvUtils.writeCsv(canDetailDongFengs,outPath);
    }

}

